package person.bluext.singlegateway.gateway;


import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.stereotype.Component;
import person.bluext.singlegateway.frame.function.AbstractFuncStore;
import person.bluext.singlegateway.gateway.handler.HealthCheckHandler;

import javax.annotation.PostConstruct;

/**
 * Description : The function store of project
 *
 * @author bluext
 */
@Component
public class TheFuncStore extends AbstractFuncStore {

    @Getter
    @AllArgsConstructor
    public enum FunctionRegister {
        //---------------------------
        //-- 在此处注册接口信息
        //-- [接口名称]([接口描述], [接口处理类], [接口处理方法])
        //---------------------------
        FUNC_HEALTH("health check , 健康检查", HealthCheckHandler.class, "hello"),;

        private String funcDesc;
        private Class funcClass;
        private String funcMethod;
    }

    @PostConstruct
    public void registerList() {
        for (FunctionRegister functionRegister : FunctionRegister.values()) {
            this.register(functionRegister.getFuncDesc(), functionRegister.getFuncClass().getSimpleName(), functionRegister.getFuncMethod(), functionRegister.name());
        }
    }
}
